using System;
using System.Collections.Generic;
using System.Text;
using Belmost4PDA.DatabaseWorkPDA;

namespace Belmost4PDA.Fasade
{
    public class QueryClsBuilder:AbstractQueryBuilder
    {
        public string SQL = "";
        public List<DataRows.DataRows> Ld;
        private int position = -1;
        public QuerySelect query = new QuerySelect();
        public QueryClsBuilder(string Sql)
        {
            SQL=Sql;
        }

        public override void Create(List<AbstractMapper> Mappers, int idBr)
        {
            throw new NotImplementedException();
        }

        public override void Execute()
        {
            query.Select(SQL);
            Ld = query.GetRows();
            position = -1;

        }

        public override DataRows.DataRows Select()
        {
            position++;
            if (Ld!=null && position < Ld.Count) return Ld[position];
            else return null;
        }

        public virtual bool Eof()
        {
            if(position>=Ld.Count-1) return true;
            else return false;
        }
    }
}
